<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>问答</title>
    <link rel="stylesheet" type="text/css" href="__CSS__api.css"/>
    <link rel="stylesheet" type="text/css" href="__CSS__aui.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__dropload.css" />

    <style>
        body {
            margin-top: 0.525rem;
        }
        .list_content {
            background-color: #ffffff;
            width: 100%;
            height: auto;
            padding: 0.75rem;
            padding-bottom: 0.375rem;
            margin-bottom: 0.5rem;
        }
        .person_inf {
            width: 100%;
            height: 2rem;
            margin-bottom: 0.675rem;
        }
        .per_img {
            width: 2rem;
            height: 2rem;
            border-radius: 50%;
            overflow: hidden;
            margin-right: 0.5rem;
        }
        .per_img img {
            width: 100%;
            height: 100%;
        }
        .name_show {
            height: 2rem;
        }
        .name {
            width: 10rem;
            height: 1rem;
            line-height: 1.3rem;
            font-size: 0.75rem;
            color: #333333;
            font-weight: medium;
        }
        .time {
            width: 100%;
            height: 1rem;
            line-height: 1.5rem;
            font-size: 0.7rem;
            color: #999999;
        }
        .tit_top {
            width: 100%;
            color: #4D4D4D;
            font-size: 0.75rem;
            line-height: 1.05rem;
            font-weight: bold;
            margin-bottom: 0.5rem;
        }
        .tit_content {
            width: 100%;
            color: #808080;
            font-size: 0.7rem;
            line-height: 1rem;
            height: auto;
            margin-bottom: 0.75rem;
        }
        .talk {
            margin: auto;
            width: 2.5rem;
            padding: 0 0.525rem;
        }
        .talk img {
            width: 0.85rem;
            height: 0.85rem;
        }
        .talk_num {
            font-size: 13px;
            line-height: 0.85rem;
            color: #cccccc;
            width: auto;
            margin-left: 0.25rem;
        }
        .out_talk {
            width: 100%;
            padding-top: 0.5rem;
        }

        .photoAll {
            display: inline-block;
            margin-bottom: 0.5rem;
            margin-right: 11px;
        }
        .photo {
            display: inline-block;
            position: relative;
        }
        .photo:nth-child(3n+2) {
            margin-right: 12.5px;
            margin-left: 12.5px;
        }
        .photo img {
            display: inline-block;
            width: 100px!important;
            height: 100px!important;

        }

        .talk1 {
            width: 5rem;
        }

        .aui-bar-nav .aui-iconfont {
            position: relative;
            font-family: "aui_iconfont" !important;
            font-size: 0.75rem;
            color: #E73C5C;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            height: 2.4rem;
        }

        .aui-icon-tu{
            height: 2.4rem;
            width: 49px;
            background: url('__IMG__left.png') no-repeat 0.5rem center;
            background-size: 22px 22px;
        }
        .aui-bar-nav .aui-title{
            font-size: 0.9rem;
            color: #333333;
            font-weight: 500;
        }
        .aui-icon-rightu{
            height: 2.4rem;
            width: 49px;
            /*background: url('__IMG__search.png') no-repeat 0.6rem center;*/
            background-size: 22px 22px;
        }
        .aui-tab-item.aui-active {
            color: #E73C5C;
            font-size: 17px;
            position: relative;
            border-bottom: none !important;
        }

        .aui-tab-item {
            height: 2.03rem;
            /*line-height: 2.03rem;*/
            color: #333333;
            font-weight: medium;
            font-size: 17px;
        }
        .sss {
            width: 100%;
            padding: 0 25%;
        }
        .aui-bar-nav {
            background-color: #ffffff;
        }

    </style>
</head>
<body>
<header class="aui-bar aui-bar-nav underLine" style="padding-top:25px;"id="header">
    <a class="aui-pull-left" tapmode="active" onclick="history.go(-1)"> <span class="aui-iconfont aui-icon-tu"> </span> </a>

    <div class="aui-title">
        <div class="aui-tab bar">
            <div class=" sss aui-tab bar nav " id="tab">
                <div class="aui-tab-item aui-active aaa" onclick="tab_qh(this)" idd="1">
                    热门
                </div>
                <div class="aui-tab-item bbb" onclick="tab_qh(this)"  idd="2">
                    最新
                </div>
            </div>
        </div>
    </div>

    <a class="aui-pull-right" >
        <span class="aui-iconfont aui-icon-rightu" tapmode="active" onclick="right()">提问</span>
    </a>
</header>
<div class="upOrDown">
    <div class="upOrDown_data">
            {volist name="list" id="vo"}
            <div class="list_content" onclick="xq(this)" idd="{$vo.interlocution_id}" tapmode>
                <div class="person_inf flex-wrap">
                    <div class="per_img">
                        <img src="{$vo.user_image}" alt="">
                    </div>
                    <div class="name_show flex-con">
                        <div class="name aui-ellipsis-1">
                            {$vo.user_username}
                        </div>
                        <div class="time">
                           {$vo.interlocution_time}
                        </div>
                    </div>
                </div>
                <div class="tit_top aui-ellipsis-2">
                    {$vo.interlocution_title}
                </div>
                <div class="tit_content ">
                    {$vo.interlocution_introduce}
                </div>
                <div class="photoAll">
                    {volist name="vo['img']" id="vv"}
                    <div class="photo" tapmode>
                        <img  src="{$vv}" />
                    </div>
                    {/volist}
                </div>
                {if $vo['interlocution_num']>0}

                <div class="out_talk topLine">
                    <div class="talk flex-wrap ">
                        <div class='flex-con'>
                            <img src="__IMG__talk@3x.png"  alt="">
                        </div>
                        <div class="talk_num">{$vo.interlocution_num}</div>
                    </div>
                </div>
                {else /}
                <div class="out_talk topLine">
                    <div class="talk flex-wrap talk1" >
                        <div class='flex-con'>
                            <img src="__IMG__anwser@3x.png"  alt="">
                        </div>
                        <div class="talk_num" style="color:#5BAEFF;font-size:0.7rem;">
                            我要回答
                        </div>
                    </div>
                </div>
                {/if}
            </div>
            {/volist}
    </div>
</div>
</body>
<script type="text/javascript" src="__JS__jquery.min.js"></script>

<script type="text/javascript" src="__JS__dropload.min.js"></script>

<script type="text/javascript" src="__JS__api.js"></script>

<script type="text/javascript">

        $api.addEvt($api.byId('text1'),'input',function(){

            var searchValue = $api.val($api.byId("text1")) || "";

            if(searchValue.length>=200){
                $api.byId('num1').innerHTML=200;
                $api.byId('num2').innerHTML=0;

                $api.val($api.byId("text1"),searchValue.slice(0,200));

            }else{
                $api.byId('num1').innerHTML=searchValue.length;
                $api.byId('num2').innerHTML=200-searchValue.length;
            }

        });
    //右边点击事件
    function right() {
        location.href='{:url("First/wdanswer")}';

    }

    //问答详情
    function xq(el) {
        var idd=$api.attr(el,'idd');
//        location.href='{:url("First/wdanswer")}'
        location.href='{:url("First/answerdetail")}?id='+idd;

    }
    function tab_qh(el) {
        var aaaaaaaaaa=$api.attr(el,'idd');
        if(aaaaaaaaaa==1){
            $(".aaa").addClass('aui-active');
            $(".bbb").removeClass('aui-active');
        }else if(aaaaaaaaaa==2){
            $(".bbb").addClass('aui-active');
            $(".aaa").removeClass('aui-active');
        }
        getData(aaaaaaaaaa);
    }
    function getData(type) {
        page = 1 ;
        $.ajax({
            url:'{:url("First/ajaxanswerhot")}',
            data:{'page':page,type:type},//
            type:'POST',
            dataType:'JSON',
            success: function(data){
                $('.upOrDown_data').empty();

                var datas = data.msg;
                    $.each(datas,function(key,v){
                        var _html='';
                        _html +='<div class="list_content cooc" tapmode id="'+v.interlocution_id+'">';
                        _html +='<div class="person_inf flex-wrap"> ' +
                                '       <div class="per_img"> ' +
                                '<img src="'+v.user_image+'" alt=""> ' +
                                '</div> ' +
                                '<div class="name_show flex-con"> ' +
                                '   <div class="name aui-ellipsis-1">'+v.user_username  + '</div>';
                        _html +='<div class="time">' + v.interlocution_time +
                                '</div> </div></div> ' +
                                '<div class="tit_top aui-ellipsis-2">'+v.interlocution_title+'</div>';
                        _html +='<div class="tit_content ">'+v.interlocution_introduce +'</div>';
                        $.each(v.img,function (kk,vv) {
                            _html +='<div class="photoAll"><div class="photo" tapmode> <img  src="'+vv+'" /> </div> </div>';
                        })
                        if(v.num>0){
                            _html +='<div class="out_talk topLine"> <div class="talk flex-wrap "> ' +
                                    '<div class="flex-con"> ' +
                                    '<img src="__IMG__talk@3x.png"  alt=""> ' +
                                    '</div> <div class="talk_num">'+ v.interlocution_num+ '</div>' +
                                    '</div> </div> ';
                            _html +=  '</div>';
                        }else{
                            _html +='<div class="out_talk topLine"> <div class="talk flex-wrap talk1"> ' +
                                    '<div class="flex-con"> ' +
                                    '<img src="__IMG__anwser@3x.png"  alt=""> ' +
                                    '</div> <div class="talk_num">我要回答</div>' +
                                    '</div> </div> ';
                        }

                        $(".upOrDown_data").append(_html);

                    });
                $('.cooc').click(function () {
                    var id = $(this).attr('id');
                    location.href='{:url("First/answerdetail")}?id='+id;

                });
                dropload.unlock();
                dropload.noData(false);
                dropload.resetload();
            },error: function(){
                alert('Ajax error!');
            }

        });
    }
</script>

<script>
    var page = 1;
    var dropload = $('.upOrDown').dropload({

        scrollArea : window,
        autoLoad : true,
        loadDownFn : function(me){
            page++;
            var type = $(".aui-active").attr('idd');
            $.ajax({
                url:'{:url("First/ajaxanswerhot")}',
                data:{'page':page,type:type},//
                type:'POST',
                dataType:'JSON',
                success: function(data){
                    var arrLen = data.msg.length;
                    if(arrLen<=0){
                        me.lock();
//                         无数据
                        me.noData(true);
                        // 每次数据加载完，必须重置
                        me.resetload();
                    }else{
                        var datas = data.msg;
                        $.each(datas,function(key,v){

                            var _html='';

                            _html +='<div class="list_content cooc" tapmode id="'+v.interlocution_id+'">';
                            _html +='<div class="person_inf flex-wrap"> ' +
                                '       <div class="per_img"> ' +
                                            '<img src="'+v.user_image+'" alt=""> ' +
                                        '</div> ' +
                                    '<div class="name_show flex-con"> ' +
                                    '   <div class="name aui-ellipsis-1">'+v.user_username  + '</div>';
                             _html +='<div class="time">' + v.interlocution_time +
                                     '</div> </div></div> ' +
                                     '<div class="tit_top aui-ellipsis-2">'+v.interlocution_title+'</div>';
                            _html +='<div class="tit_content ">'+v.interlocution_introduce +'</div>';
                            $.each(v.img,function (kk,vv) {
                                _html +='<div class="photoAll"><div class="photo" tapmode> <img  src="'+vv+'" /> </div> </div>';
                            })
                            if(v.num>0){
                                _html +='<div class="out_talk topLine"> <div class="talk flex-wrap "> ' +
                                        '<div class="flex-con"> ' +
                                        '<img src="__IMG__talk@3x.png"  alt=""> ' +
                                        '</div> <div class="talk_num">'+ v.interlocution_num+ '</div>' +
                                        '</div> </div> ';
                                _html +=  '</div>';
                            }else{
                                _html +='<div class="out_talk topLine"> <div class="talk flex-wrap talk1"> ' +
                                        '<div class="flex-con"> ' +
                                        '<img src="__IMG__anwser@3x.png"  alt=""> ' +
                                        '</div> <div class="talk_num">我要回答</div>' +
                                        '</div> </div> ';
                            }
                            $(".upOrDown_data").append(_html);

                        });
                        // 每次数据加载完，必须重置
                        me.resetload();


                    }
                    $('.cooc').click(function () {
                        var id = $(this).attr('id');
                        location.href='{:url("First/answerdetail")}?id='+id;

                    });
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    // 即使加载出错，也得重置
                    me.resetload();

                }
            });
        },
        loadUpFn : function(me){
            page = 1;
            var type = $(".aui-active").attr('idd');

            $.ajax({
                url:'{:url("First/ajaxanswerhot")}',
                data:{'page':page,type:type},//
                type:'POST',
                dataType:'json',
                success: function(data){
                    $('.upOrDown_data').empty();//
                    var datas = data.msg;
                    $.each(datas,function(key,v){
                        var _html='';
                        _html +='<div class="list_content cooc" tapmode id="'+v.interlocution_id+'">';
                        _html +='<div class="person_inf flex-wrap"> ' +
                                '       <div class="per_img"> ' +
                                '<img src="'+v.user_image+'" alt=""> ' +
                                '</div> ' +
                                '<div class="name_show flex-con"> ' +
                                '   <div class="name aui-ellipsis-1">'+v.user_username  + '</div>';
                        _html +='<div class="time">' + v.interlocution_time +
                                '</div> </div></div> ' +
                                '<div class="tit_top aui-ellipsis-2">'+v.interlocution_title+'</div>';
                        _html +='<div class="tit_content ">'+v.interlocution_introduce +'</div>';
                        $.each(v.img,function (kk,vv) {
                            _html +='<div class="photoAll"><div class="photo" tapmode> <img  src="'+vv+'" /> </div> </div>';
                        })

                        if(v.num>0){
                            _html +='<div class="out_talk topLine"> <div class="talk flex-wrap "> ' +
                                    '<div class="flex-con"> ' +
                                    '<img src="__IMG__talk@3x.png"  alt=""> ' +
                                    '</div> <div class="talk_num">'+ v.interlocution_num+ '</div>' +
                                    '</div> </div> ';
                            _html +=  '</div>';
                        }else{
                            _html +='<div class="out_talk topLine"> <div class="talk flex-wrap talk1"> ' +
                                    '<div class="flex-con"> ' +
                                    '<img src="__IMG__anwser@3x.png"  alt=""> ' +
                                    '</div> <div class="talk_num">我要回答</div>' +
                                    '</div> </div> ';
                        }
                        $(".upOrDown_data").append(_html);

                    });
                    me.resetload();
                    me.unlock();
                    me.noData(false);
                    $('.cooc').click(function () {
                        var id = $(this).attr('id');
                        location.href='{:url("First/answerdetail")}?id='+id;
                    });
                },
                error: function(xhr, type){
                    alert('Ajax error!');
                    me.resetload();
                }
            });
        }
    });
</script>
</html>
